package cn.bearspark.api.controller.main;

import cn.bearspark.api.service.main.BookLiveService;
import cn.bearspark.api.vo.main.booklive.CancelReqVO;
import cn.bearspark.api.vo.main.booklive.StateReqVO;
import cn.bearspark.framework.web.starter.vo.ResponseVO;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 动态的预约直播模块
 *
 * @author f
 */
@Validated
@RestController
@RequestMapping("/bookLive")
public class BookLiveController {

    private final BookLiveService bookLiveService;

    public BookLiveController(BookLiveService bookLiveService) {
        this.bookLiveService = bookLiveService;
    }

    /**
     * 撤销直播预约
     *
     * @param cancelReqVO 撤销直播预约的请求对象
     * @return 响应对象
     */
    @PostMapping("/cancel")
    public ResponseVO<Object> cancel(@Valid @RequestBody CancelReqVO cancelReqVO) {
        return bookLiveService.cancel(cancelReqVO);
    }

    /**
     * 修改预约直播状态
     *
     * @param stateReqVO 修改预约直播状态的请求对象
     * @return 响应对象
     */
    @PostMapping("/state")
    public ResponseVO<Object> state(@Valid @RequestBody StateReqVO stateReqVO) {
        return bookLiveService.state(stateReqVO);
    }

}
